package org.dromara.demo.domain;

import org.dromara.common.tenant.core.TenantEntity;
import com.alibaba.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import jakarta.validation.constraints.*;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;

/**
 * 单表对象 demo_example4
 *
 * @author wenrui Su
 * @date 2024-05-21
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("demo_example4")
public class DemoExample4 extends TenantEntity {

  @Serial
  private static final long serialVersionUID=1L;


  @ExcelProperty(value = "主键")
  @NotNull(message = "主键不能为空", groups = { EditGroup.class })
  @TableId(value = "id")
  private Long id;

  @ExcelProperty(value = "名称")
  @NotBlank(message = "名称不能为空", groups = { AddGroup.class, EditGroup.class })
  private String name;

  @ExcelProperty(value = "乐观锁")
  @Version
  private Long version;

  @ExcelProperty(value = "逻辑删除")
  private Long delFlag;

  @ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
  @ExcelDictFormat(dictType = "sys_status")
  @NotBlank(message = "状态不能为空", groups = {AddGroup.class, EditGroup.class})
  private String status;

  @ExcelProperty(value = "备注")
  private String remark;

  @ExcelProperty(value = "客户")
  @NotNull(message = "客户不能为空", groups = {AddGroup.class, EditGroup.class})
  private Long customerId;
}
